# gnumake

CC	= dmc
LIBR	= lib
CFLAGS	= -Jm -I. -Iinclude -Icompat -IWIN32-Code -D_WINMM_ \
	-DWIN32=1 -D_WIN32=1 -D_STDCALL_SUPPORTED=1 -DSSIZE_T="int" \
	-DHAVE_CONFIG_H=1 -D_EVENT_HAVE_STDINT_H

CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
	bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
	strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
	bufferevent_ratelim.obj evutil_rand.obj minheap-internal.obj

WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
	event_iocp.obj bufferevent_async.obj

EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj

all:libevent.lib

%.obj: %.c
	$(CC) $(CFLAGS) $^ -c -o$@

libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
	$(LIBR) -c $@ $^

libevent_extras.lib: $(EXTRA_OBJS)
	$(LIBR) -c $@ $^

libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
	$(LIBR) -c $@ $^
	del ..\libeventd\test\$@
	cp $@ ..\libeventd\test\$@

test.obj: ../test.c
	dmc $(CFLAGS) $^ -c -o$@

test: test.obj
	link $^,2test.exe,,advapi32+ws2_32+user32+shell32+kernel32+libevent/noi/delexe;

clean:
	del /Q /S *.map *.obj *.lib *.bak
